#ifndef WIDGETHANDLER_H
#define WIDGETHANDLER_H

#include <QWidget>
#include <QHash>
#include <QObject>
#include "WidgetId.h"

#define SYSTEM_VERSION      "V1.0"
#define ARM_VERSION         "24020201" //版本号
/*
 * 2023-09-08, 纯黑色改为(1,0,0),未查询到患者时出现？？？,优化查询逻辑
 * 2023-10-13, 修改部分翻译，修改部分文字颜色为白色，修复脚踏冻结无提示, 修改病人信息界面删除退出的方式
 * 2023-11-03, 寄存器读写异常问题
 * 2023-11-07，图像异常轮询 并通知mcu对解码板断电
 * 2023-11-18，图像设置界面第一次进入界面不对
 * 2024-02-02，修改设置界面的版本
*/
#include "BootUi.h"
#include "LoginUi.h"
#include "HomeUi.h"
#include "ImageSettingUi.h"
#include "SystemSettingUi.h"
#include "AddPatientUi.h"
#include "QueryPatientUi.h"
#include "PatientInfoUi.h"
#include "ModifyPatientUi.h"
#include "PhotoPlayerUi.h"
#include "VideoPlayerUi.h"
#include "EngineerUi.h"

class WidgetHandler
{
public:
    static WidgetHandler* getInstance();
    void init(QWidget* parent);

    void displayWidget(WidgetId id);
    void hideWidget(WidgetId id);
    BaseWidget* getWidget(WidgetId id);

private:
    WidgetHandler();
    void addWidgets();
    void bindingSignal();

    QWidget* g_parent;
    WidgetId g_currentWidgetId = Null_Id;
    QHash<int, WidgetDescription*> g_allWidgets;

    BootUi* g_bootUi = nullptr;
    LoginUi* g_loginUi = nullptr;
    HomeUi* g_homeUi = nullptr;
    ImageSettingUi* g_imageSettingUi = nullptr;
    SystemSettingUi* g_systemSettingUi = nullptr;
    AddPatientUi* g_addPatientUi = nullptr;
    QueryPatientUi* g_queryPatientUi = nullptr;
    PatientInfoUi* g_patientInfoUi = nullptr;
    ModifyPatientUi* g_modifyPatientUi = nullptr;
    PhotoPlayerUi* g_photoPlayerUi = nullptr;
    VideoPlayerUi* g_videoPlayerUi = nullptr;
    EngineerUi* g_engineerUi = nullptr;
};

#endif // WIDGETHANDLER_H
